home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / amiga / asrc29k.lha / iface.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  3.7 KB  |  101 lines

  1. #ifndef    NULLIF
  2. #include "global.h"
  3.  
  4. /* Interface control structure */
  5. struct iface {
  6.     struct iface *next;    /* Linked list pointer */
  7.     char *name;        /* Ascii string with interface name */
  8.     char *descr;        /* Description of interface */
  9.     int type;        /* Link header type for phdr */
  10.     struct iftype *iftype;    /* Pointer to appropriate iftype entry */
  11.     int32 addr;        /* IP address */
  12.     int32 broadcast;    /* Broadcast address */
  13.     int32 netmask;        /* Network mask */
  14.     int (*ioctl) __ARGS((struct iface *,int,char **));
  15.                 /* Function to handle device control */
  16.     int (*send) __ARGS((struct mbuf *,struct iface *,int32,int,int,int,int));
  17.                 /* Routine to send an IP datagram */
  18.     int (*output) __ARGS((struct iface *,char *,char *,int16,struct mbuf *));
  19.                 /* Routine to send link packet */
  20.     int (*raw) __ARGS((struct iface *,struct mbuf *));
  21.                 /* Routine to call to send raw packet */
  22.     int (*stop) __ARGS((struct iface *));
  23.                 /* Routine to call before detaching */
  24.     int16 mtu;        /* Maximum transmission unit size */
  25.     int dev;        /* Subdevice number to pass to send */
  26.     int xdev;        /* Associated Slip or Nrs channel, if any */
  27.     int port;        /* Kiss sub-address for multi port support - G1EMM */
  28.     int16 flags;        /* Configuration flags */
  29. #define    DATAGRAM_MODE    0    /* Send datagrams in raw link frames */
  30. #define    CONNECT_MODE    1    /* Send datagrams in connected mode */
  31.     int16 trace;        /* Trace flags */
  32. #define    IF_TRACE_OUT    0x01    /* Output packets */
  33. #define    IF_TRACE_IN    0x10    /* Packets to me except broadcast */
  34. #define    IF_TRACE_ASCII    0x100    /* Dump packets in ascii */
  35. #define    IF_TRACE_HEX    0x200    /* Dump packets in hex/ascii */
  36. #define    IF_TRACE_NOBC    0x1000    /* Suppress broadcasts */
  37.     char *trfile;        /* Trace file name, if any */
  38.     FILE *trfp;        /* Stream to trace to */
  39.     char *hwaddr;        /* Device hardware address, if any */
  40.     struct iface *forw;    /* Forwarding interface for output, if rx only */
  41.     int32 ipsndcnt;        /* IP datagrams sent */
  42.     int32 rawsndcnt;    /* Raw packets sent */
  43.     int32 iprecvcnt;    /* IP datagrams received */
  44.     int32 rawrecvcnt;    /* Raw packets received */
  45.     int32 lastsent;        /* Clock time of last send */
  46.     int32 lastrecv;        /* Clock time of last receive */
  47.     struct proc *proc;    /* Pointer to line process, if any */
  48.     struct proc *proc1;    /* Second line process, if any */
  49. };
  50. #define    NULLIF    (struct iface *)0
  51. extern struct iface *Ifaces;    /* Head of interface list */
  52. extern struct iface Loopback;    /* Optional loopback interface */
  53.  
  54. /* Header put on front of each packet in input queue */
  55. struct phdr {
  56.     struct iface *iface;
  57.     unsigned short type;
  58. #define    TYPE_AX25    0
  59. #define    TYPE_ETHER    1
  60. #define    TYPE_IP        2
  61. #define TYPE_APPLETALK    3
  62. #define    TYPE_KISS    4
  63. #define    TYPE_NETROM    5
  64. #define    TYPE_NONE    6
  65. #define    TYPE_SLIP    7
  66. #define TYPE_PPP    8
  67. #define    NLTYPE        9
  68. };
  69. extern char Noipaddr[];
  70. extern struct mbuf *Hopper;
  71.  
  72. /* Interface encapsulation mode table entry. An array of these strctures
  73.  * are initialized in config.c with all of the information necessary
  74.  * to attach a device.
  75.  */
  76. struct iftype {
  77.     char *name;        /* Name of encapsulation technique */
  78.     int (*send) __ARGS((struct mbuf *,struct iface *,int32,int,int,int,int));
  79.                 /* Routine to send an IP datagram */
  80.     int (*output) __ARGS((struct iface *,char *,char *,int16,struct mbuf *));
  81.                 /* Routine to send link packet */
  82.     char *(*format) __ARGS((char *,char *));
  83.                 /* Function that formats addresses */
  84.     int (*scan) __ARGS((char *,char *));
  85.                 /* Reverse of format */
  86.     int type;        /* Type field for network process */
  87.     int hwalen;        /* Length of hardware address, if any */
  88. };
  89. #define    NULLIFT    (struct iftype *)0
  90. extern struct iftype Iftypes[];
  91.  
  92. /* In iface.c: */
  93. struct iface *if_lookup __ARGS((char *name));
  94. struct iface *ismyaddr __ARGS((int32 addr));
  95. int if_detach __ARGS((struct iface *ifp));
  96. int setencap __ARGS((struct iface *ifp,char *mode));
  97.  
  98. #endif    /* NULLIF */
  99.  
  100.  
  101.